﻿using System.ComponentModel.DataAnnotations;
using FlyingHat.Common.Helper;
using FlyingHat.Model.Attribute.Model;
using FlyingHat.Model.Enums;

namespace FlyingHat.Model.Models
{
    public class UserModel
    {
        public long Id { get; set; }
        /// <summary>
        /// 用户名
        /// </summary>
        [Required(ErrorMessage = "用户名不能为空")]
        [RegularExpression(RegularHelper.UserName, ErrorMessage = "用户名只能由6-24位数字字母组成")]
        public string UserName { get; set; } = string.Empty;

        /// <summary>
        /// 真实姓名
        /// </summary>
        [Required(ErrorMessage = "姓名不能为空")]
        [RealName(ErrorMessage = "姓名长度不能超过50个字符")]
        public string RealName { get; set; } = string.Empty;

        /// <summary>
        /// 手机号
        /// </summary>
        [Required(ErrorMessage = "手机号不能为空")]
        [RegularExpression(RegularHelper.Phone, ErrorMessage = "手机号格式错误")]
        public string Phone { get; set; } = string.Empty;
        /// <summary>
        /// 头像
        /// </summary>
        public string Avatar { get; set; } = string.Empty;
        public int BlockDay { get; set; }

        /// <summary>
        /// 性别
        /// </summary>
        public Gender Gender { get; set; }
        public string GenderStr => Gender.GetDescription();
        /// <summary>
        /// 用户状态
        /// </summary>
        public UserStatus UserStatus { get; set; }
        public string UserStatusStr => UserStatus.GetDescription();

        /// <summary>
        /// 用户身份
        /// </summary>
        public Identity Identity { get; set; }
        public string IdentityStr => UserStatus.GetDescription();
        /// <summary>
        /// 最后登录时间
        /// </summary>
        public DateTime LastLoginTime { get; set; }
    }
}
